package exercise6;

public class Person {
    private int age;
    private String name;

    public Person() {
        age = 18;
    }

    public Person(String name) {
        age = 18;
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if ((0 <= age) &&(age <= 130)){
            this.age = age;
        }
        else {
            System.out.println("您设置的 age 值不合理");
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
